<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>
<%@taglib prefix="mu" uri="/WEB-INF/tld/mallutil.tld" %>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="/WEB-INF/tld/importTag.tld" prefix="import" %>

<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<script src="<c-rt:url value="/js/cart.js"/>"></script>
<script src="<c-rt:url value="/js/jquery.floatinglayer.min.js"/>"></script>
<script type="text/javascript" charset="UTF-8" src="<%=ServerValue.getFrontContextPath()%>/js/jquery.cookie.js"></script>
<script src="<c-rt:url value="/js/product.js"/>"></script>
<!--
<script src="<c-rt:url value="/js/select-option-disabled-emulation.js"/>"></script>
-->
<jsp:include page="/common/collection.jsp"/>
<link rel="stylesheet" href="/css/pdpagese.css" type="text/css" media="screen" />
<c-rt:set var="frontContentHtmlPath" value='<%=ServerValue.getFrontContentHtmlPath()%>'/>
${pu:reqSet('currentDate', pu:currentDate()) }
<c-rt:if test="${!empty param.productId}">
${pu:reqSet('addOnHql', 'from AddOnProduct where mainProductId=? and addOnPrice!=? and isEnable=? and isDelete!=? and startDate <=? and endDate >=?') }

 

<c-rt:if test="${product.productType=='6'}">
${pu:reqSet('toBuyMethod', 'toBuy(\'addOnProductNm\')') }
${pu:reqSet('toAddCartMethod', 'toAddCart3()') }
</c-rt:if>
<c-rt:if test="${product.productType!='6'}">
${pu:reqSet('toBuyMethod', 'toBuy(\'addOnProductB\')') }
${pu:reqSet('toAddCartMethod', 'toAddCart2()') }
</c-rt:if>
</c-rt:if>

<script>
$(function(){
	//小手
	$("div.pimage").mouseover(function(){
		$(this).css("cursor","pointer");
	});
	$("a.haveInventoryA").mouseover(function(){
		$(this).css("cursor","pointer");
	});
	<c-rt:choose>
		<c-rt:when test="${!empty param.z}">
			$("#main").attr("class","${zCategory.templateId}");
		</c-rt:when>
		<c-rt:otherwise>
			$("#main").attr("class","${category.templateId}");
		</c-rt:otherwise>
	</c-rt:choose>
	initCategory();

	<c-rt:choose>
	<c-rt:when test="${empty param.key_pageable_currentPage && empty param.ask}">
	$('#j_tabs').tabs();
	</c-rt:when>
	<c-rt:otherwise>
	$('#j_tabs').tabs();
	$('#j_tabs').tabs('select', 1);
	$('.pdtab > li > a').each(function(i){
		$(this).removeClass('pdtab-f');
		if(i==1){
			$(this).addClass('pdtab-f');
		}
	});
	
	</c-rt:otherwise>
	</c-rt:choose>

	${pu:reqSet('categoryHql', 'from Category where id=?') }
	<c-rt:set var="array" value="${fn:split(category.categoryPath, '/')}"/>
	${pu:listAdd('cparams', pu:toLong(array[0])) }
	${pu:reqSet('mcat', pu:queryByHql(categoryHql, pu:arrayGet('cparams'), null)) }
	
	<c-rt:set scope="request" var="documentTitle">
	${product.productName} - ${mcat[0].name}- 耀点100
	</c-rt:set>
	<%
	String documentTitle=(String)request.getAttribute("documentTitle");
	documentTitle=documentTitle.replaceAll("\n", "");
	documentTitle=documentTitle.replaceAll("\"", "");
	documentTitle=documentTitle.replaceAll("'", "");
	request.setAttribute("documentTitle", documentTitle);
	%>
	document.title='${documentTitle}';

	<c-rt:set var="haveInventory" value="false"/>
	var specIndex=0;
	<c-rt:forEach items="${product.specifications}" var="spec" varStatus="status">
	
	<c-rt:if test="${spec.isDelete!='Y'}">
	<c-rt:set var="parasSpecInventory" value="${null}"/>
	<c-rt:set var="paramsSpecInventory" value="${pu:addToList('parasSpecInventory', spec.specificationId)}"/>
	<c-rt:set var="specInventorys" value="${pu:queryByHql('from SpecificationInventory where specId=?', paramsSpecInventory, null)}"/>
	<c-rt:set scope="request" var="sis" value="${pu:addToList('siss', specInventorys[0])}"/>
	specs[specIndex]="${spec.specificationId}";
	specNames[specIndex]="${spec.specificationName}";
	maxPOQ[specIndex]=${spec.maxCountPerOrder};
	minPOQ[specIndex]=${spec.minCountPerOrder};
	hotSaleInventory[specIndex]=${spec.hotSaleInventory};
	inventory[specIndex]=${specInventorys[0].inventory!=null?specInventorys[0].inventory:0};
	soldInventory[specIndex]=${specInventorys[0].soldInventory!=null?specInventorys[0].soldInventory:0};
	specIndex++;
	<c-rt:if test="${specInventorys[0].inventory>0 && product.productType!='6'}">
	haveInventory=true;
	<c-rt:set var="haveInventory" value="true"/>
	</c-rt:if>

	</c-rt:if>
	</c-rt:forEach>
	init();
	initSpec();
	syncAddOnProduct();
	if($("#spec")[0].length == 2){
		//alert($("#spec")[0].options[1].value);
		$("#spec")[0].options[1].setAttribute('selected',true);
		changeInventory($("#spec")[0].options[1].value);
	}	
});
function initCategory(){
	$("#menu > ul > li[class*='tab']").eq(10).attr("class","tab11");
	$("#menu-11").hide();
	var tempZid;
	var zid;
	if ( "${not empty zCategory}" == "true" ){
		tempZid = parseInt("${zCategory.categoryPath}".split("/")[0],10);
		zid= parseInt("${zCategory.categoryPath}".split("/")[0],10);
	}else{
		tempZid = parseInt("${category.categoryPath}".split("/")[0],10);
		zid= parseInt("${category.categoryPath}".split("/")[0],10);
	}
	
	if ( tempZid < 10 ) tempZid = "0" + tempZid;
	
	$("li.tab" + tempZid).attr("class","tab" + tempZid + "-f");
	$("#menu-" +zid).show();
}
function showDefaultMenu(){
	$("#menu > div[id*='menu-']" ).each(function(){
		$(this).hide();
	});
	initCategory();
}
var haveInventory=false;
var content;
var specs=new Array();
var maxPOQ=new Array();
var minPOQ=new Array();
var hotSaleInventory = new Array();
var inventory=new Array();
var specNames=new Array();
var soldInventory=new Array();
var productType='${product.productType}';
var categoryLevel="${category.level}";
var categoryId="${category.id}";
var categoryPath="${category.categoryPath}";
var productPickQty=${product.pickupQty!=null?product.pickupQty:0};

var loginUrl='<c-rt:url value="/tologin.do?redirect_url=/product/product.do?productId=${product.productId }"/>';
var fullUrl = '<%=ServerValue.getFrontHostname()+ServerValue.getFrontContextPath()%>';


</script>
<div class="sidebar">
	<!-- sidebar start -->
	<c-rt:choose>
		<c-rt:when test="${!empty param.z}">
			<import:static path="${frontContentHtmlPath}${zCategory.id}/SIDEBAR_P.html"/>
		</c-rt:when>
		<c-rt:otherwise>
			<import:static path="${frontContentHtmlPath}${product.mainCategoryID}/SIDEBAR_P.html"/>
		</c-rt:otherwise>
	</c-rt:choose>
	<!-- sidebar end -->
	<div class="ad-sky">
		<script type="text/javascript">
			GA_googleFillSlot("yd100_${tempZId}_sidebar_right_image_01");
		</script>
	</div>
  <div class="lt-bn-end">
  	<script type="text/javascript">
			GA_googleFillSlot("yd100_${tempZId}_sidebar_right_image_02");
			GA_googleFillSlot("yd100_${tempZId}_sidebar_right_image_03");
		</script>
  </div>  		
</div>

 <!-- content start -->
    <div class="content">
      <div class="pd-mainbox">
        <div class="pd-photobox">
          <div class="pimage"><img src="/PImg/${pu:substring(product.productId, 0, 4)}/${product.productId }/${product.productId }_m250.jpg" onError="this.src='/PImg/blank_250.gif'" alt="" width="250" height="250"  onclick="openDialog('商品图片',$('#load500Img').html(), 535, 560)"/></div>
          <div class="pd-number">
            <p>商品编号：${product.productId }</p>
            <input type="hidden" id="productId" value="${product.productId }"/>
            <input type="hidden" id="webpath" name="webpath" value="<%=application.getContextPath().substring(1, application.getContextPath().length()) %>"/>
            <input type="hidden" id="categoryPath" name="categoryPath" value="${product.mainCategoryID }"/>
            <input type="hidden" id="type" name="type" value="${product.productType }"/>
            <!-- 
            <p><a href="" title="推荐好友得红利"><img src="/images/pd/bt_recommend.gif" alt="推荐好友得红利" width="114" height="22" /></a></p>
            -->
            <p><span class="icon-safe">7天可退，15天可换</span></p>
            <p class="pdimg-icon-line">
            	<c-rt:forEach items="${productCampaigns}" var="pc">
            	<c-rt:set scope="request" var="campaignDetail">
            	${pu:replaceAll(pc.campaignDetail, '\'', '&#39;')}
            	</c-rt:set>
            	<c-rt:set scope="request" var="campaignDesc">
            	${pu:replaceAll(pc.campaignDesc, '\'', '&#39;')}
            	</c-rt:set>
            	<script>
					function openDialog_${status.index}(){
						<%
						String campaignDetail=(String)request.getAttribute("campaignDetail");
						String campaignDesc=(String)request.getAttribute("campaignDesc");
						campaignDetail=campaignDetail.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
						campaignDesc=campaignDesc.replaceAll("\r\n", "").replaceAll("\r", "").replaceAll("\n", "");
						request.setAttribute("campaignDetail", campaignDetail);
						request.setAttribute("campaignDesc", campaignDesc);
						%>
					openDialog('活动信息', compositeCampaign('${pu:replaceAll(pc.campaignName, '\'', '&#39;')}', '${campaignDetail}', '${campaignDesc}', '<fmt-rt:formatDate value="${pc.startDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '<fmt-rt:formatDate value="${pc.endDateTime}" pattern="yyyy/MM/dd HH:mm:ss"/>', '${pc.campaignUrl}'), 300, 'auto');
					$( "#dialog" ).dialog( "option", "position", 'top' );
					}
            	</script>
            	<a class="btn-promo" href="javascript:openDialog_${status.index }()">
            	<c-rt:if test="${pc.type.desc!='赠品'}">
            	${pc.type.desc }
            	</c-rt:if>
            	<c-rt:if test="${pc.type.desc=='赠品'}">
            	　${pc.type.desc }　
            	</c-rt:if>
            	</a>

            	</c-rt:forEach>
            	
            </p>
          </div>
        </div>
        <div id="forTab" class="pd-infobox">
          <div class="infoboxheader">
            <p><strong>${shelfs[0].promoteName}</strong></p>
            <h1>${product.productName }</h1>
          </div>
          <div class="infocontent">
          ${pu:reqSet('brief',mu:productBrief(param.productId)) }
          <pre>${brief!=null?brief:'<br/><br/>'}</pre>
          </div>
          <div class="infocontent-type">

<import:around enableCache="false" url="product/product/present" appendParameter="productId">
${pu:reqSet('presentHql', 'from AddOnProduct where mainProductId=? and addOnPrice=? and isEnable=? and isDelete=? and startDate<=? and endDate>=?') }
${pu:listAdd('params', param.productId) }
${pu:listAdd('params', pu:toLong(0)) }
${pu:listAdd('params', 'Y') }
${pu:listAdd('params', 'N') }
${pu:listAdd('params', currentDate) }
${pu:listAdd('params', currentDate) }
${pu:reqSet('presents', pu:queryByHql(presentHql, pu:arrayGet('params'), null)) }
<c-rt:forEach items="${presents}" var="present" varStatus="presentIndex">
${pu:reqSet('pp', pu:get('com.yaodian100.ec.product.entity.Product', present.addOnProductId)) }
	${pu:listAdd('pProducts', pp) }
	${pu:reqSet('specInventorysList', null) }
	${pu:reqSet('hasPresent', pu:toBoolean('false')) }
	<c-rt:if test="${pProducts[presentIndex.index].isDelete != 'Y' and pProducts[presentIndex.index].isDelete != 'Q'}">
		<c-rt:forEach items="${pProducts[presentIndex.index].specifications}" var="spec">
			<c-rt:if test="${spec.isDelete!='Y'}">
				${pu:reqSet('psInventory', null)}
				${pu:listAdd('psInventory', spec.specificationId)}
				${pu:reqSet('specInventorys2', pu:queryByHql('from SpecificationInventory where specId=?', pu:arrayGet('psInventory'), null))}
				
				${pu:listAdd('SpecInventorysList', specInventorys2[0]) }
				${pu:reqSet('hasPresent', pu:toBoolean('false')) }
				
				<c-rt:if test="${specInventorys2[0].inventory>0}">
					<c-rt:if test="${!hasPresent }">
						${pu:listAdd('presentSpecs', spec) }
						${pu:reqSet('hasPresent', pu:toBoolean('true')) }
						${pu:listAdd('presentInventorys', specInventorys2[0].inventory) }
					</c-rt:if>
					
				</c-rt:if>
				<c-rt:if test="${specInventorys2[0].inventory<=0}">
					${pu:listAdd('presentSpecs', null) }
					${pu:listAdd('presentInventorys', 0) }
				</c-rt:if>
			${pu:listAdd('presentSpecInventorysList', pu:arrayGet('specInventorysList')) }
			</c-rt:if>
		</c-rt:forEach>
	</c-rt:if>
</c-rt:forEach>      

            <c-rt:if test="${hasPresent}">
            <p><span class="type-2">赠品</span>
            ${pu:reqSet('ssssaaaa', 0) }
				<c-rt:forEach items="${presents}" var="present" varStatus="presentStatus">
				
				
					<c-rt:if test="${!empty presentSpecs[presentStatus.index]}">
					<script>
					var presentInventory_${ssssaaaa}=${pu:listGet('presentInventorys')[presentStatus.index]};
				</script>
					<input type="hidden" class="presents" name="presents" value="${present.addOnProductId }_${presentSpecs[presentStatus.index].specificationId}_1_${pProduct.mainCategoryID}_2_<%=application.getContextPath() %>"/>
						${present.addOnDesc }
						<c-rt:set scope="request" var="ssssaaaa">
						${pu:toInteger(ssssaaaa)+1 }
						</c-rt:set>
					</c-rt:if>
				</c-rt:forEach>
			</p>
            </c-rt:if>
</import:around>

           
           	${pu:reqSet('hqlCampaign', 'from Campaign c where ? in elements(c.rangeExtList) and c.enable = ? and c.delete = ? and c.startDateTime <= ? and c.endDateTime >= ? and c.type=?')}
           	${pu:listAdd('paramsCampaign', pu:toString(product.productId)) }
           	${pu:listAdd('paramsCampaign', pu:toBoolean('true')) }
           	${pu:listAdd('paramsCampaign', pu:toBoolean('false')) }
           	${pu:listAdd('paramsCampaign', currentDate) }
           	${pu:listAdd('paramsCampaign', currentDate) }
           	${pu:listAdd('paramsCampaign', 'S01')}
           	${pu:reqSet('campaigns', pu:queryByHql(hqlCampaign, pu:arrayGet('paramsCampaign'), null)) }
           
           	<c-rt:if test="${campaigns[0].typeExtends[0].campaignTypeExtension > 0}">
            <p><span class="type-money">&nbsp;</span>买就<span class="txt-rd">送购物金 ＄
            <b>${campaigns[0].typeExtends[0].campaignTypeExtension }</b>
           
            </span></p>
             </c-rt:if>
            <c-rt:if test="${product.productType==1}">
            <p><span class="type-1">预购</span>预计<b><big><fmt-rt:formatDate value="${product.expectShipDate}" pattern="yyyy-MM-dd"/></big></b>开始出货</p>
            </c-rt:if>
            <p>商品重量：
            <c-rt:if test="${product.productWeight>0}">
            <fmt-rt:formatNumber value="${(product.productWeight+0.001)/1000 }"  pattern="#,#0.00#"/>
            </c-rt:if>
            <c-rt:if test="${product.productWeight<=0}">
            0
            </c-rt:if>
            KG (<a href="/help/6_deliveryfee.html" target="_blank">重量与运费说明</a>)</p> 
          </div>
          <div class="grey-price">市场价：<b><c-rt:if test="${!empty product.listPrice}">${pu:currency(product.listPrice) }</c-rt:if></b></div>
          <div class="infocontent-price">会员价：<b><c-rt:if test="${!empty shelfs[0].shelfPrice}">${pu:currency(shelfs[0].shelfPrice) }</c-rt:if></b></div>
          
          <c-rt:if test="${product.productType!='6'}">
          <div class="select-bar">
            <div><strong>请选择：</strong>
              <select id="spec" name="spec" onchange="changeInventory(this.value)">
              </select>
            </div>
            <div><strong>我要买</strong>
              <select name="qty" id="qty">
				
              </select>
              <strong>件</strong></div>
            <div class="saled"></div>
          </div>
          </c-rt:if>
          <c-rt:if test="${product.productType=='6'}">
          <input type="hidden" id="qty" name="qty" value="1"/>
          <input type="hidden" id="spec" name="spec" value=""/>
          </c-rt:if>
<%--不为n选m才显示 --%>
<c-rt:if test="${product.productType !='6' }">
<import:around enableCache="false" url="product/product/addOnProductS" appendParameter="productId">
${pu:reqSet('params', null) }
${pu:listAdd('params', param.productId) }
${pu:listAdd('params', pu:toLong(0)) }
${pu:listAdd('params', 'Y') }
${pu:listAdd('params', 'Y') }
${pu:listAdd('params', currentDate) }
${pu:listAdd('params', currentDate) }
${pu:reqSet('addOnProducts', pu:queryByHql(addOnHql, pu:arrayGet('params'), null)) }
   
          <c-rt:if test="${!empty addOnProducts}">
<c-rt:if test="${status.index<=4}">
   	<c-rt:set var="anchor" value="addOnBefore"/>
   </c-rt:if>
   <c-rt:if test="${status.index>4}">
   	<c-rt:set var="anchor" value="addOnAfter"/>
   </c-rt:if>

          <div class="buymorebox">
            <div><strong>加购商品：</strong></div>
            <table border="0" class="tb-buymore">
            ${pu:reqSet('aopIndex', 0)}
           	${pu:reqSet('haveNoAddOnProduct', true) }
            <c-rt:forEach items="${addOnProducts}" var="addOnProduct" varStatus="status">
            
            <c-rt:set var="aoproduct" value="${pu:get('com.yaodian100.ec.product.entity.Product', addOnProduct.addOnProductId)}"/>
             ${pu:reqSet('hasAopproduct', false) }
             <c-rt:forEach items="${aoproduct.specifications}" var="spec">
             <c-rt:if test="${spec.isDelete=='N'}">
             ${pu:reqSet('parasSpecInventory', null)}
             ${pu:listAdd('parasSpecInventory', spec.specificationId)}
             ${pu:reqSet('aopiHql', 'from SpecificationInventory where specId=?') }
             ${pu:reqSet('aopSpecInventorys', pu:queryByHql(aopiHql, pu:arrayGet('parasSpecInventory'), null)) }
             	<c-rt:forEach items="${aopSpecInventorys}" var="inventory">
             		<c-rt:if test="${inventory.inventory>0}">
             			${pu:reqSet('hasAopproduct', true) }
             			${pu:reqSet('haveNoAddOnProduct', false) }
             			${pu:reqSet('aopproductSpecId', spec.specificationId) }
             		</c-rt:if>
             	</c-rt:forEach>
            </c-rt:if>
            </c-rt:forEach>
            <c-rt:if test="${hasAopproduct}">
            <%--
             <c-rt:if test="${aopIndex==0}">
             	<c-rt:set var="overStyle">
             	class="buymore-f"
             	</c-rt:set>
             	<c-rt:set var="os">
             	style="height:45px"
             	</c-rt:set>
             </c-rt:if>
              
             <c-rt:if test="${aopIndex!=0}">
             --%>
             <c-rt:if test="${true }">
             	<c-rt:set var="overStyle">
             	</c-rt:set>
             	<c-rt:set var="os">
             	</c-rt:set>
             </c-rt:if>
              <tr class="addOnItem">
                <th ${overStyle }><input class="addOnProduct" name="addOnProduct" type="checkbox" value="${addOnProduct.addOnProductId }_${aopproductSpecId}_1_${aoproduct.mainCategoryID}_3_<%=application.getContextPath() %>">
                  </th>
                <td ${overStyle } style="cursor:pointer" ><a onclick="moveBottom(${status.index });"><img src="/PImg/${pu:substring(addOnProduct.addOnProductId, 0,4) }/${addOnProduct.addOnProductId }/${addOnProduct.addOnProductId }_m100.jpg" onError="this.src='/PImg/blank_100.gif'" alt="" width="45" height="45" /></a><table id="addOnTable" border="0" cellspacing="0" cellpadding="0" ${os }><tr><td valign="middle" style="border:0px"><a href="javascript:;" onclick="moveBottom(${status.index });" >${addOnProduct.addOnDesc }</a></td></tr></table></td>
                <td ${overStyle }><span class="txt-price">加购价<c-rt:if test="${!empty addOnProduct.addOnPrice}">${pu:currency(addOnProduct.addOnPrice)}</c-rt:if></span></td>
              </tr>
              ${pu:reqSet('aopIndex', (aopIndex+1))}
              
             </c-rt:if>

             <c-rt:if test="${status.last && haveNoAddOnProduct}">
             <tr>
             	<td>
             	<script>
					$(function(){
						$('.buymorebox').hide();
						$('.pluspurchase').hide();
					});
             	</script>
             	</td>
             </tr>
             </c-rt:if>
             
           	</c-rt:forEach>
            </table>
            <p align="right" class="cf"><a href="#pluspurchase">&gt;详情</a></p>
          </div>

          </c-rt:if>
</import:around>
</c-rt:if>
          <div class="bt-box">
            <div class="icon-col-position"> <span class="icon-collection"><a title="加入收藏夹！" id="addWishList_${product.productId }_${product.listPrice }" href="javascript:;">加入收藏夹</a></span> </div>
            	<c-rt:if test="${product.isDelete!='Q'}">
	            <a class="haveInventoryA" href="###" onclick="${toBuyMethod}" title="立即购买" style="cursor: pointer"><span class="bt-buy"></span></a>
	             <c-rt:if test="${product.productType!='1'}">
	             <a class="haveInventoryA" href="###" onclick="${toAddCartMethod}" title="加入购物车！" style="cursor: pointer"><span class="bt-cart" ></span></a> 
	             </c-rt:if>
	             <c-rt:if test="${product.productType=='1'}">
	            
	        	  	<div class="none-cart haveInventoryA" title="预购商品无法加入购物车，请使用「加入收藏夹」功能！" ><span>加入购物车</span></div> 
	             </c-rt:if>
	             <div class="none-buy haveNoInventoryA" title="此商品已售完，正在补货中！"><span>已售完补货中</span></div> 
	             <div class="none-cart haveNoInventoryA" title="商品已售完无法加入购物车，请使用「加入收藏夹」功能！" ><span>加入购物车</span></div> 
            	</c-rt:if>
            	<c-rt:if test="${product.isDelete=='Q'}">
          <div class="commingsoon"><span>即将开卖</span><%--开卖时间：TODO--%></div>
          <div class="none-cart" style="cursor: pointer"><span>加入购物车</span></div> 
          </c-rt:if>
            </div>
        </div>
      </div>
      <c-rt:if test="${product.productType=='6'}">
      <import:wrap enableCache="false" url="/WEB-INF/jsp/product/nm.jsp" appendParameter="productId"/>
      </c-rt:if>
      <div style="clear:both">
      ${pu:reqSet('tp', pu:pageableTag('key', 5, 10))}
      ${pu:listAdd('paramsQaa', 'CommonQuestion') }
      ${pu:listAdd('paramsQaa', 'productId') }
      ${pu:listAdd('paramsQaa', product.productId) }
      ${pu:listAdd('paramsQaa', pu:toBoolean('true')) }
	  ${pu:reqSet('hql', 'from QuestionExtraValue qev where qev.question.type.name=? and qev.name=? and qev.value=? and qev.question.answer!=null and qev.question.answer.showOnProductPage=? order by qev.question.createDate desc')}
	  ${pu:reqSet('qeas', pu:queryByHql(hql, pu:arrayGet('paramsQaa'), tp)) }
      <div id="j_tabs">
        <ul class="pdtab">
          <li><a class="pdtab-f" href="#productInfo">商品信息</a></li>
          <li><a href="#productqaa">商品问答(<b class="txt-bl">${tp.totalRecords }</b>)</a></li>
          <li><a href="#productMustRead">购物须知</a></li>
        </ul>
        
       <div id="productInfo">
       		<import:wrap enableCache="false" url="/WEB-INF/jsp/product/productInfo.jsp?productId=${product.productId}" appendParameter="productId"/>
       </div>
       <div id="productqaa">
       		<import:wrap enableCache="false" url="/WEB-INF/jsp/product/productqaa.jsp?productId=${product.productId}" appendParameter="productId"/>
       </div>
       <div id="productMustRead">
      <%--
       		<import:wrap url="/WEB-INF/jsp/product/productMustRead.jsp" appendParameter="productId"/>
       		 --%>
       		
       		${pu:reqSet('mustRead', mu:shoopingMustRead(product.productId)) }
       		
       		<c-rt:if test="${!empty mustRead}">
       			${mustRead }
       		</c-rt:if>
       		<c-rt:if test="${empty mustRead}">
       		<c-rt:set var="midProdHtmlPath">
       		 <%=ServerValue.getMidProdHtmlPath() %>${pu:split(category.categoryPath, '/')[0]}.txt
       		</c-rt:set>
       			<import:static path="${midProdHtmlPath}"/>
       		</c-rt:if>
       		
       </div>
      </div>
      </div>
      <%--不为n选m才显示 --%>
<c-rt:if test="${product.productType !='6' }">
<import:around enableCache="false" url="product/product/addOnProductB" appendParameter="productId">
<c-rt:if test="${empty addOnProducts}">
${pu:reqSet('params', null) }
${pu:listAdd('params', param.productId) }
${pu:listAdd('params', pu:toLong(0)) }
${pu:listAdd('params', 'Y') }
${pu:listAdd('params', 'Y') }
${pu:listAdd('params', currentDate) }
${pu:listAdd('params', currentDate) }
${pu:reqSet('addOnProducts', pu:queryByHql(addOnHql, pu:arrayGet('params'), null)) }
</c-rt:if>

 <!-- 加購商品點擊後看到的layer --> 
			<div id="presentDiv"></div>
       <!-- 加購商品點擊後看到的layer --> 
      <c-rt:if test="${!empty addOnProducts}">
      <a name="pluspurchase"></a>
      <div class="pluspurchase">
        <div id="purchaseBox" class="purchasebox">
        <c-rt:forEach items="${addOnProducts}" var="addOnProduct" varStatus="aopStatus">
        <c-rt:set var="aoproduct" value="${pu:get('com.yaodian100.ec.product.entity.Product', addOnProduct.addOnProductId)}"/>
        <c-rt:set var="url">
        	<%=ServerValue.getFrontContextPath()%>/product/addOnProductInfo.do?productId=${product.productId }&addOnProductId=${addOnProduct.addOnProductId }
        </c-rt:set>
        	<c-rt:set var="parasAddOnShelf" value="${null}"/> 
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', addOnProduct.addOnProductId)}"/>
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', currentDate)}"/>
        	<c-rt:set var="paramsAddOnShelf" value="${pu:addToList('parasAddOnShelf', currentDate)}"/>
        	<c-rt:set var="addOnShelfs" value="${pu:queryByHql('from Shelf where productId=? and startDate <= ? and endDate >=?', paramsAddOnShelf, null)}"/>
          
          ${pu:reqSet('hasAopproduct', false) }
             <c-rt:forEach items="${aoproduct.specifications}" var="spec">
             <c-rt:if test="${spec.isDelete=='N'}">
             ${pu:reqSet('parasSpecInventory', null)}
             ${pu:listAdd('parasSpecInventory', spec.specificationId)}
             ${pu:reqSet('aopiHql', 'from SpecificationInventory where specId=?') }
             ${pu:reqSet('aopSpecInventorys', pu:queryByHql(aopiHql, pu:arrayGet('parasSpecInventory'), null)) }
             	<c-rt:forEach items="${aopSpecInventorys}" var="inventory">
             		<c-rt:if test="${inventory.inventory>0}">
             			${pu:reqSet('hasAopproduct', true) }
             			${pu:reqSet('aopproductSpecId', spec.specificationId) }
             		</c-rt:if>
             	</c-rt:forEach>
            </c-rt:if>
            </c-rt:forEach>
            <c-rt:if test="${hasAopproduct}">
          <div class="purchaseinnerbox" id="purchaseinnerbox_${aopStatus.index}">
            <div class="pd-pluspurchasethumb"> <a href="javascript:;" onclick="openDialog('',$('#presentDiv').load('${url}'),337,590);return false;"><img src="/PImg/${pu:substring(addOnProduct.addOnProductId, 0,4) }/${addOnProduct.addOnProductId }/${addOnProduct.addOnProductId }_m100.jpg" onError="this.src='/PImg/blank_100.gif'" alt="" width="100" height="100" /></a> </div>
            <div class="pd-pluspurchasethumb"> <a href="javascript:;" onclick="openDialog('',$('#presentDiv').load('${url}'),337,590);return false;">${addOnProduct.addOnDesc }</a> </div>
            <div class="pd-pluspurchasethumb"> <span>市场价￥${aoproduct.listPrice}</span> </div>
            <div class="pd-pluspurchasethumb">
              <p>加购价:<b>￥${addOnProduct.addOnPrice }</b></p>
            </div>
            <ul class="pd-pluspurchasethumb">
              <li>
                <input id="aopb_${aopStatus.index}" class="addOnProductB" name="addOnProductB" type="checkbox" value="${addOnProduct.addOnProductId }_${aopproductSpecId}_1_${aoproduct.mainCategoryID}_3_<%=application.getContextPath() %>">
                我要加购</li>
            </ul>
          </div>
          </c-rt:if>
          </c-rt:forEach>
        </div>
      </div>
      </c-rt:if>
</import:around>
</c-rt:if>
      <div class="bt-bottom">
        <div class="bt-box">
          <div class="icon-col-position"> <span class="icon-collection"><a id="addWishList_${product.productId }_${product.listPrice }" href="javascript:;" title="加入收藏夹！">加入收藏夹</a></span> </div>
          <c-rt:if test="${product.isDelete!='Q'}">
          <a class="haveInventoryA" href="###" onclick="${toBuyMethod}" title="立即购买" style="cursor: pointer"><span class="bt-buy"></span></a> 
          <c-rt:if test="${product.productType!='1'}">
          <a class="haveInventoryA" href="###" onclick="${toAddCartMethod}" title="加入购物车！" style="cursor: pointer"><span class="bt-cart"></span></a> 
          </c-rt:if>
          <c-rt:if test="${product.productType=='1'}">
        	  	<div class="none-cart haveInventoryA" title="预购商品无法加入购物车，请使用「加入收藏夹」功能！" ><span>加入购物车</span></div> 
		      </c-rt:if>
          <div class="none-buy haveNoInventoryA" title="此商品已售完，正在补货中!" ><span>已售完补货中</span></div>
	      	<div class="none-cart haveNoInventoryA" title="商品已售完无法加入购物车，请使用「加入收藏夹」功能！" ><span>加入购物车</span></div>
          </div>
          </c-rt:if>
          <c-rt:if test="${product.isDelete=='Q'}">
          <div class="commingsoon"><span>即将开卖</span><%--开卖时间：TODO--%></div>
          <div class="none-cart" style="cursor: pointer"><span>加入购物车</span></div> 
          </c-rt:if>
      </div>
    </div>
    <!-- content end -->
    
    <form name="toBuyForm" action="<c-rt:url value="/shopping/orderBuyNow.do"/>" method="post">
    	<input type="hidden" name="itemNo"/>
    	<input type="hidden" name="specNo"/>
    	<input type="hidden" name="categoryPath"/>
    	<input type="hidden" name="type"/>
    	<input type="hidden" name="presents"/>
    	<input type="hidden" name="addOns"/>
    	<input type="hidden" name="qty"/>
    	<input type="hidden" name="webpath"/>
    </form>
    <div id="dialog"></div>
<style>
#j_tabs.ui-tabs .ui-tabs-nav {
background:#FFFFFF; 


}
.ui-widget-header{
	border:0px;
	padding:0px;
}
#j_tabs.ui-tabs .ui-tabs-panel{
	padding:0px;
}
#j_tabs.ui-widget {
	border:0px;
}
.pdtab li a:link, .pdtab li a:visited {
	width:115px;
	brder:0px;
}
#j_tabs.ui-tabs .ui-tabs-nav li{
	margin:0px;
	margin-right:5px;
}
#j_tabs.ui-tabs .ui-tabs-nav li a {
	padding:2px 15px;
}
#j_tabs.ui-state-active, #j_tabs.ui-widget-content .ui-state-active {
	border:0px;
	padding-bottom:0px;
}
#j_tabs.ui-state-hover{
	padding-bottom:0px;
}
#j_tabs.ui-state-default, #j_tabs.ui-widget-content .ui-state-default {
	border:0px;
}
.pdnm-alert p{
line-height:4em;
}
.collection-dailog-ok p {
background:transparent url(/images/icon_big.gif) no-repeat scroll 15px 5px;
line-height:4em;
padding:10px 0 10px 100px;
}
.haveNoInventoryA{
display:none;
}
</style>   
<div id="load500Img" style="display:none;">
	<img src="/PImg/${pu:substring(product.productId, 0, 4)}/${product.productId }/${product.productId }_m500.jpg" onError="this.src='/PImg/blank_500.gif'" alt="" width="500" height="500"/>
</div>
<div id="edmscript" style="display:none;"></div>
<%--
<c-rt:set var="aHql">
from Question where extraValue['productId'].value=?
</c-rt:set>
${pu:listAdd('params', '111') }
${pu:reqSet('questions', pu:queryByHql(aHql, pu:arrayGet('params'), null)) }
<c-rt:forEach items="${questions}" var="q">
	${q.description }
</c-rt:forEach>
 --%>